package com.example.android.codelabs.navigation

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter
import android.widget.ListView
import androidx.fragment.app.Fragment
import entity.Fruit
import android.widget.AdapterView;
import android.widget.Toast


class ShoppingFragment<ListAdapter> : Fragment() {
    val data = arrayOf(
        "菠萝", "芒果", "石榴", "葡萄", "苹果", "橙子", "西瓜", "菠萝", "芒果", "石榴", "葡萄", "苹果", "橙子", "西瓜", "菠萝", "芒果", "石榴", "葡萄", "苹果", "橙子", "西瓜"
    )
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        val view = inflater.inflate(R.layout.shop_fragment, container, false)
        val listView = view.findViewById<ListView>(R.id.list_view)
        val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_list_item_1, data)
        listView.adapter = adapter
        return view
    }




}